<?php
namespace app\common\model;

use think\Model;

class Orders extends Model
{
	public function merchant()
    {
        return $this->hasOne('AgentInfo', 'agent_id', 'agent_id');
    }

    public function goods(){
    	return $this->hasOne('OrdersGoods','order_id','id');
    }

    public function getStatusAttr($value){
    	$status = ['0'=>'已关闭','1'=>'待支付','2'=>'预约拍摄','3'=>'待拍摄','4'=>'选片中'];
    	return $status[$value];
    }

    public function platformCoupon(){
        return $this->hasOne('CouponLogs','id','platform')->field('id,coupon_id');
    }

    public function discountCoupon(){
        return $this->hasOne('CouponLogs','id','discount')->field('id,coupon_id');
    }

    public function photos(){
        return $this->hasOne('OrdersPhotos','order_id','id');
    }
}